package com.example.myapplication.ui.fragment.collect

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.myapplication.request.CollectRequest
import kotlinx.coroutines.launch

/**
 *文章收藏列表
 *
 * @author : Kun
 * @date : 2021/6/7
 * @time : 17:52
 */
class ArticleCollectViewModel : ViewModel() {
    /**
     * 收藏相关的请求
     */
    val collectRequest = CollectRequest()

    /**
     * 获取收藏文章
     */
    fun requestCollectArticle(index: Int) {
        viewModelScope.launch {
            collectRequest.requestCollectArticle(index)
        }
    }

    /**
     * 取消收藏
     */
    fun requestDelCollectArticleForMe(id: Int,originId:Int) {
        viewModelScope.launch {
            collectRequest.requestDelCollectArticleForMe(id,originId)
        }
    }
}